/*
 * uds_types.h
 *
 *  Created on: Apr 25, 2021
 *      Author: taoyu
 */

#ifndef UDSSERVER_INC_UDS_TYPES_H_
#define UDSSERVER_INC_UDS_TYPES_H_

typedef enum
{
	UDS_SID_SESSION_CONTROL = 0x10,
	UDS_SID_ECU_RESET = 0x11,
	UDS_SID_SECURITY_ACCESS = 0x27,
	UDS_SID_TESTER_PRESENT = 0x3E,
	UDS_SID_READ_DATA_BY_ID = 0x22,
	UDS_SID_READ_MEM_BY_ADDR = 0x23,
	UDS_SID_WRITE_DATA_BY_ID = 0x2E,
	UDS_SID_WRITE_MEM_BY_ADDR = 0x3D,
	UDS_SID_IO_CONTROL = 0x2F,
	UDS_SID_ROUTINE_CONTROL = 0x31,

	// FBL
	UDS_SID_REQ_DOWNLOAD = 0x34,
	UDS_SID_REQ_UPLOAD = 0x35,
	UDS_SID_XFER_DATA = 0x36,
	UDS_SID_XFER_EXIT = 0x37,
}
UDS_SID;

typedef enum
{
	UDS_SESSION_RESERVED_00 = 0x00,
	UDS_SESSION_DEFAULT = 0x01,
	UDS_SESSION_PROGRAMMING = 0x02,
	UDS_SESSION_EXTENDED = 0x03,
	UDS_SESSION_SAFETY = 0x04,
	// 0x05 ~ 0x3F: ISO Reserved
	// 0x40 ~ 0x5F: VMS (vehicle manufacturer specific)
	// 0x60 ~ 0x7E: SSS (system supplier specific)
	UDS_SESSION_RESERVED_7F = 0x7F,
}
UDS_SESSION;

typedef enum
{
	UDS_NRC_OK = 0,

	UDS_NRC_GENERAL_REJECT = 0x11,
	UDS_NRC_SUB_FUNCTION_NOT_SUPPORTED = 0x12,
	UDS_NRC_INCORRECT_MESSAGE_LENGTH_OR_INVALID_FORMAT = 0x13,
	UDS_NRC_CONDITION_NOT_CORRECT = 0x22,
	UDS_NRC_REQUEST_SEQUENCE_ERROR = 0x24,
	UDS_NRC_REQUEST_OUT_OF_RANGE = 0x31,
	UDS_NRC_SECURITY_ACCESS_DENIED = 0x33,
}
UDS_NRC;

typedef enum
{
	UDS_IOCP_RETURN_CONTROL_TO_ECU = 0,
	UDS_IOCP_RESET_TO_DEFAULT = 1,
	UDS_IOCP_FREEZE_CURRENT_STATE = 2,
	UDS_IOCP_SHORT_TERM_ADJUST = 3,

	UDS_IOCP_TOTAL_NUMBERS
}
UDS_IOCP;	//	Input Output Control Parameter

typedef enum
{
	UDS_RCTP_RESERVED_0 = 0,
	UDS_RCTP_START = 1,
	UDS_RCTP_STOP = 2,
	UDS_RCTP_REQUEST_RESULT = 3,

	UDS_RCTP_TOTAL_NUMBERS
}
UDS_RCTP;	// routine control type

#endif /* UDSSERVER_INC_UDS_TYPES_H_ */
